{
    "resourceType": "Bundle",
    "id": "BundleSurgery4Test",
    "meta": {
        "profile": [
            "https://fhir.by/AbstractArea/StructureDefinition/Bundle/MedicationDocument"
        ]
    },
    "identifier": {
        "system": "https://fhir.by/ValueSet/urn:ietf:rfc:3086",
        "value": "{{$guid}}"
    },
    "type": "document",
    "timestamp": "2025-11-15T21:00:00Z",
    "entry": [
        {
            "fullUrl": "Composition/CompositionSurgery4Test",
            "resource": {
                "resourceType": "Composition",
                "id": "CompositionSurgery4Test",
                "meta": {
                    "profile": [
                        "https://fhir.by/StructureDefinition/CompDocument"
                    ]
                },
                "status": "final",
                "type": {
                    "coding": [
                        {
                            "system": "https://fhir.by/ValueSet/CompositionType",
                            "code": "general",
                            "display": "Общая медицинская информация"
                        }
                    ]
                },
                "subject": [
                    {
                        "reference": "Patient/PatientTest"
                    }
                ],
                "date": "2025-11-17T21:00:00Z",
                "author": [
                    {
                        "reference": "Practitioner/{{PractitionerId}}"
                    }
                ],
                "title": "CompDocument для наполненного Bundle по оперативному вмешательству",
                "custodian": {
                    "reference": "Organization/{{OrganizationId}}"
                },
                "event": [
                    {
                        "detail": [
                            {
                                "reference": {
                                    "reference": "Condition/ComplicationbleedingTest"
                                }
                            }
                        ]
                    },
                    {
                        "detail": [
                            {
                                "reference": {
                                    "reference": "AdverseEvent/ComplicationAppendectomyTest4"
                                }
                            }
                        ]
                    },
                    {
                        "detail": [
                            {
                                "reference": {
                                    "reference": "Procedure/SurgicalHemostasisTest"
                                }
                            }
                        ]
                    }
                ]
            }
        },
        {
            "fullUrl": "Patient/PatientTest",
            "resource": {
                "resourceType": "Patient",
                "id": "PatientTest",
                "meta": {
                    "profile": [
                        "https://fhir.by/StructureDefinition/PatientWithIdentificationNumber"
                    ]
                },
                "extension": [
                    {
                        "extension": [
                            {
                                "url": "https://fhir.by/StructureDefinition/ConsentPersonalDataBoolean",
                                "valueBoolean": true
                            },
                            {
                                "url": "https://fhir.by/StructureDefinition/ConsentPersonalDataPeriod",
                                "valuePeriod": {
                                    "start": "2025-01-01"
                                }
                            }
                        ],
                        "url": "https://fhir.by/StructureDefinition/ConsentPersonalData"
                    }
                ],
                "identifier": [
                    {
                        "use": "usual",
                        "type": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/PersonalDocumentType",
                                    "code": "INP",
                                    "display": "Уникальный идентификационный номер"
                                }
                            ]
                        },
                        "value": "7551374A009PB9"
                    },
                    {
                        "extension": [
                            {
                                "extension": [
                                    {
                                        "url": "https://fhir.by/StructureDefinition/PassportIssuedString",
                                        "valueString": "Центральным РУВД г Минска, 21.08.2021"
                                    },
                                    {
                                        "url": "https://fhir.by/StructureDefinition/PassportIssuedDate",
                                        "valueDate": "2021-08-21"
                                    },
                                    {
                                        "url": "https://fhir.by/StructureDefinition/PassportIssuedCode",
                                        "valueCodeableConcept": {
                                            "coding": [
                                                {
                                                    "system": "https://fhir.by/ValueSet/OCAM",
                                                    "code": "710"
                                                }
                                            ]
                                        }
                                    }
                                ],
                                "url": "https://fhir.by/StructureDefinition/PassportIssued"
                            }
                        ],
                        "use": "usual",
                        "type": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/PersonalDocumentType",
                                    "code": "Passport-RB",
                                    "display": "Паспорт гражданина Республики Беларусь"
                                }
                            ]
                        },
                        "value": "MP2334555"
                    }
                ],
                "active": true,
                "name": [
                    {
                        "family": "Иванов",
                        "given": [
                            "Петр",
                            "Сидорович"
                        ]
                    }
                ],
                "telecom": [
                    {
                        "system": "phone",
                        "value": "375295748410"
                    },
                    {
                        "system": "email",
                        "value": "test_mail@gmail.by"
                    }
                ],
                "gender": "male",
                "birthDate": "1990-12-31",
                "deceasedBoolean": false,
                "address": [
                    {
                        "extension": [
                            {
                                "url": "https://fhir.by/StructureDefinition/CoutryForAddresses",
                                "valueCodeableConcept": {
                                    "coding": [
                                        {
                                            "system": "https://fhir.by/ValueSet/CitizenshipCode",
                                            "code": "BY",
                                            "display": "Беларусь"
                                        }
                                    ]
                                }
                            },
                            {
                                "url": "https://fhir.by/StructureDefinition/StreetGeoRegistry",
                                "valueCodeableConcept": {
                                    "coding": [
                                        {
                                            "system": "https://fhir.by/ValueSet/StreetGeoRegistry",
                                            "code": "5170309411",
                                            "display": "Улица Золотая Горка"
                                        }
                                    ]
                                }
                            },
                            {
                                "url": "https://fhir.by/StructureDefinition/ApartmentRoom",
                                "valueString": "кв. 29"
                            }
                        ],
                        "use": "home",
                        "text": "г.Минск, Улица Золотая Горка, д.5, кв.29",
                        "postalCode": "220022"
                    },
                    {
                        "extension": [
                            {
                                "url": "https://fhir.by/StructureDefinition/CoutryForAddresses",
                                "valueCodeableConcept": {
                                    "coding": [
                                        {
                                            "system": "https://fhir.by/ValueSet/CitizenshipCode",
                                            "code": "BY",
                                            "display": "Беларусь"
                                        }
                                    ]
                                }
                            },
                            {
                                "url": "https://fhir.by/StructureDefinition/StreetGeoRegistry",
                                "valueCodeableConcept": {
                                    "coding": [
                                        {
                                            "system": "https://fhir.by/ValueSet/StreetGeoRegistry",
                                            "code": "51703019678",
                                            "display": "Проспект Рокоссовского"
                                        }
                                    ]
                                }
                            },
                            {
                                "url": "https://fhir.by/StructureDefinition/ApartmentRoom",
                                "valueString": "кв. 2"
                            }
                        ],
                        "use": "temp",
                        "text": "г.Минск, Проспект Рокоссовского, д.20, кв.2",
                        "postalCode": "220011"
                    }
                ],
                "maritalStatus": {
                    "coding": [
                        {
                            "system": "https://fhir.by/ValueSet/MaritalStatus",
                            "code": "married"
                        }
                    ]
                },
                "contact": [
                    {
                        "relationship": [
                            {
                                "coding": [
                                    {
                                        "system": "https://fhir.by/ValueSet/RelatedPersonType",
                                        "code": "wife"
                                    }
                                ]
                            }
                        ],
                        "name": {
                            "family": "Иванова",
                            "given": [
                                "Лариса",
                                "Ивановна"
                            ]
                        },
                        "telecom": [
                            {
                                "system": "phone",
                                "value": "802990990908"
                            }
                        ]
                    }
                ],
                "generalPractitioner": [
                    {
                        "reference": "Organization/365de972-ed7f-453e-8515-865f4c4230c2",
                        "identifier": {
                            "value": "5526",
                            "period": {
                                "start": "2008-12-11"
                            }
                        }
                    }
                ]
            }
        },
        {
            "fullUrl": "Condition/ComplicationbleedingTest",
            "resource": {
                "resourceType": "Condition",
                "id": "ComplicationbleedingTest",
                "meta": {
                    "profile": [
                        "https://fhir.by/StructureDefinition/FinalDiagnosis"
                    ]
                },
                "extension": [
                    {
                        "url": "https://fhir.by/StructureDefinition/KindOfDiagnosis",
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/KindOfDiagnosisCode",
                                    "code": "Final"
                                }
                            ]
                        }
                    },
                    {
                        "url": "https://fhir.by/StructureDefinition/AssertedDate",
                        "valueDateTime": "2025-11-17T23:00:00Z"
                    },
                    {
                        "url": "https://fhir.by/StructureDefinition/CourseOfDisease",
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/CourseOfDisease",
                                    "code": "acute"
                                }
                            ]
                        }
                    },
                    {
                        "url": "https://fhir.by/StructureDefinition/FirstTimeRevealed",
                        "valueBoolean": true
                    }
                ],
                "clinicalStatus": {
                    "coding": [
                        {
                            "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
                            "code": "active"
                        }
                    ]
                },
                "code": {
                    "coding": [
                        {
                            "system": "https://fhir.by/ValueSet/InternClassificDiseases10",
                            "code": "T81.0",
                            "display": "T81.0 - Кровотечение и гематома, осложняющие процедуру, не классифицированные в других рубриках"
                        }
                    ]
                },
                "subject": {
                    "reference": "Patient/PatientTest"
                },
                "onsetDateTime": "2025-11-17",
                "recordedDate": "2025-11-17",
                "participant": [
                    {
                        "actor": {
                            "reference": "PractitionerRole/{{PractitionerRole_surgeon}}"
                        }
                    }
                ]
            }
        },
        {
            "fullUrl": "Procedure/SurgicalHemostasisTest",
            "resource": {
                "resourceType": "Procedure",
                "id": "SurgicalHemostasisTest",
                "meta": {
                    "profile": [
                        "https://fhir.by/StructureDefinition/SurgicalProcedure"
                    ]
                },
                "extension": [
                    {
                        "url": "https://fhir.by/StructureDefinition/FromOrganization",
                        "valueReference": {
                            "reference": "Organization/{{OrganizationId}}"
                        }
                    },
                    {
                        "url": "https://fhir.by/StructureDefinition/EncounterTypeOfService",
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/EncounterTypeOfService",
                                    "code": "free",
                                    "display": "Бесплатные услуги"
                                }
                            ]
                        }
                    },
                    {
                        "url": "https://fhir.by/StructureDefinition/TermsOfService",
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/VSTermsOfService",
                                    "code": "2",
                                    "display": "стационарные"
                                }
                            ]
                        }
                    },
                    {
                        "url": "https://fhir.by/StructureDefinition/InpatientMedicalRecord",
                        "valueReference": {
                            "reference": "EpisodeOfCare/{{activeEpisodeOfCareId}}"
                        }
                    },
                    {
                        "url": "https://fhir.by/StructureDefinition/AnesthesiaType",
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/AnesthesiaType",
                                    "code": "endotracheal",
                                    "display": "Эндотрахеальный наркоз"
                                }
                            ]
                        }
                    },
                    {
                        "url": "https://fhir.by/StructureDefinition/ProcedureComplexity",
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/ProcedureComplexity",
                                    "code": "complex",
                                    "display": "Сложное"
                                }
                            ]
                        }
                    },
                    {
                        "url": "https://fhir.by/StructureDefinition/ProcedureUrgency",
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/ProcedureUrgency",
                                    "code": "emergency",
                                    "display": "Экстренное"
                                }
                            ]
                        }
                    }
                ],
                "identifier": [
                    {
                        "value": "13542",
                        "assigner": {
                            "reference": "Organization/{{OrganizationId}}"
                        }
                    }
                ],
                "status": "completed",
                "category": [
                    {
                        "coding": [
                            {
                                "system": "https://fhir.by/ValueSet/ProcedureType",
                                "code": "postoperative-complications",
                                "display": "По поводу послеоперационных осложнений"
                            }
                        ]
                    }
                ],
                "code": {
                    "coding": [
                        {
                            "system": "https://fhir.by/ValueSet/SurgicalInterventions",
                            "code": "JASH20",
                            "display": "Релапаротомия / Программированная релапаротомия"
                        }
                    ],
                    "text": "Релапаротомия, остановка кровотечения с дренированием брюшной полости"
                },
                "subject": {
                    "reference": "Patient/PatientTest"
                },
                "occurrencePeriod": {
                    "start": "2025-11-17T23:15:00Z",
                    "end": "2025-12-18T00:20:00Z"
                },
                "performer": [
                    {
                        "function": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/OperatingTeam",
                                    "code": "operator",
                                    "display": "врач-хирург оперирующий"
                                }
                            ]
                        },
                        "actor": {
                            "reference": "PractitionerRole/{{PractitionerRole_surgeon}}"
                        },
                        "period": {
                            "start": "2025-11-17T23:15:00Z",
                            "end": "2025-11-18T00:20:00Z"
                        }
                    },
                    {
                        "function": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/OperatingTeam",
                                    "code": "surgical-sister",
                                    "display": "медицинская сестра операционная"
                                }
                            ]
                        },
                        "actor": {
                            "reference": "PractitionerRole/{{PractitionerRole_nurse}}"
                        },
                        "period": {
                            "start": "2025-11-17T23:15:00Z",
                            "end": "2025-11-18T00:20:00Z"
                        }
                    },
                    {
                        "function": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/OperatingTeam",
                                    "code": "anesthetist",
                                    "display": "врач-анестезиолог-реаниматолог"
                                }
                            ]
                        },
                        "actor": {
                            "reference": "PractitionerRole/{{PractitionerRole_resuscitator}}"
                        },
                        "period": {
                            "start": "2025-11-17T23:15:00Z",
                            "end": "2025-11-18T00:20:00Z"
                        }
                    }
                ],
                "location": {
                    "reference": "Location/{{LocationId_resuscitator}}"
                },
                "reason": [
                    {
                        "concept": {
                            "coding": [
                                {
                                    "system": "https://fhir.by/ValueSet/SurgicalInterventionDiagnosis",
                                    "code": "postoperative",
                                    "display": "Диагноз после вмешательства"
                                }
                            ]
                        },
                        "reference": {
                            "reference": "Condition/ComplicationbleedingTest"
                        }
                    }
                ],
                "note": [
                    {
                        "text": "Средне-срединная лапаротомия. В брюшной полости до 1.5 литров крови со сгустками. Гемостаз прошивнием и использованием гемостатической губки. Дренирование брюшной полости"
                    }
                ]
            }
        },
        {
            "fullUrl": "AdverseEvent/ComplicationAppendectomyTest4",
            "resource": {
                "resourceType": "AdverseEvent",
                "id": "ComplicationAppendectomyTest4",
                "meta": {
                    "profile": [
                        "https://fhir.by/StructureDefinition/SurgeryComplication"
                    ]
                },
                "extension": [
                    {
                        "url": "https://fhir.by/StructureDefinition/InpatientMedicalRecord",
                        "valueReference": {
                            "reference": "EpisodeOfCare/{{activeEpisodeOfCareId}}"
                        }
                    },
                    {
                        "url": "https://fhir.by/StructureDefinition/RequestFromOrganization",
                        "valueReference": {
                            "reference": "Organization/{{OrganizationId}}"
                        }
                    }
                ],
                "status": "completed",
                "actuality": "actual",
                "category": [
                    {
                        "coding": [
                            {
                                "system": "https://fhir.by/ValueSet/ClassificComplicByTime",
                                "code": "early-complic",
                                "display": "Ранние осложнения"
                            }
                        ]
                    }
                ],
                "code": {
                    "coding": [
                        {
                            "system": "https://fhir.by/ValueSet/ComplicationPrevalence",
                            "code": "regional-hemorrhagic",
                            "display": "Регионарные геморрагические"
                        }
                    ]
                },
                "subject": {
                    "reference": "Patient/PatientTest"
                },
                "occurrenceDateTime": "2025-11-17T23:00:00Z",
                "detected": "2025-11-17T23:00:00Z",
                "resultingEffect": [
                    {
                        "reference": "Condition/ComplicationbleedingTest"
                    }
                ],
                "location": {
                    "reference": "Location/{{LocationId_surgeon}}"
                },
                "seriousness": {
                    "coding": [
                        {
                            "system": "https://fhir.by/ValueSet/ComplicationSeriousness",
                            "code": "surgical-treatment",
                            "display": "хирургическая коррекция"
                        }
                    ]
                },
                "recorder": {
                    "reference": "PractitionerRole/{{PractitionerRole_surgeon}}"
                },
                "suspectEntity": [
                    {
                        "instanceReference": {
                            "reference": "Procedure/{{ProcedureId}}"
                        }
                    }
                ],
                "mitigatingAction": [
                    {
                        "itemReference": {
                            "reference": "Procedure/SurgicalHemostasisTest"
                        }
                    }
                ]
            }
        }
    ]
}